<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>继承</title>
</head>
<body>
    
</body>
<script>
    // 创建people类属性
    class People {
        // 4.
        say='说话'
        // 2.   接收
        constructor(name,age,sex){
            this.name = name;
            this.age = age;
            this.sex = sex;
        }
        // 5. 原型属性   （也会被继承）
        like(){
            console.log("学习使我快乐")
        }
    }
    // 1。实例对象     （动态属性）
    let p = new People("张三",18,"男");
    console.log(p)

    // 3.  创建动物类   （有不一样的属性）extends People 继承相同的
    class Zoom extends People{
    // 3.2  实参接收
        constructor(name,age,likeEat){
            super(name,age)
            // 3.2 定义不一样的
            this.likeEat = likeEat
        }
    }
    // 3.1  创建实例
    let dog = new Zoom("小花",1,"狗粮");
    console.log(dog)
</script>
</html>